/*
 * @Author: YNT 2501512800@qq.com
 * @Date: 2022-06-19 15:06:46
 * @LastEditors: YNT 2501512800@qq.com
 * @LastEditTime: 2022-09-29 03:09:40
 * @FilePath: \智慧社区的副本\src\api\modules\basic-data.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export default class {
  // 获取注册用户
  getPersonList(days) {
    return this.request({
      url: `/admin/v1/screen_data/user_echat?days=${days}`,
      method: 'GET'
    })
  }

  // 获取活动数据
  getActivityDate(days) {
    return this.request({
      url: `/admin/v1/screen_data/active_echat?days=${days}`,
      method: 'GET'
    })
  }

  // 获取积分数据
  getScoreDate(days) {
    return this.request({
      url: `/admin/v1/screen_data/balance_echat?days=${days}`,
      method: 'GET'
    })
  }

  // 获取积分数据
  getTalentDate(days) {
    return this.request({
      url: `/admin/v1/screen_data/talent_echat?days=${days}`,
      method: 'GET'
    })
  }

  // 获取点击量
  getCount(id, days) {
    return this.request({
      url: `/admin/v1/screen_data/apply_echat?id=${id}&days=${days}`,
      method: 'GET'
    })
  }

  // 获取物业工单数据
  getOrdersDate(days) {
    return this.request({
      url: `/admin/v1/screen_data/report_echat?days=${days}`,
      method: 'GET'
    })
  }

  // 获取物业工单数据2
  getOrderDetail(id, days) {
    return this.request({
      url: `/admin/v1/screen_data/report_echat_single?id=${id}&days=${days}`,
      method: 'GET'
    })
  }

  // #region 小区管理
  getCommunityList(params) {
    return this.request({
      url: '/admin/v1/subdistrict/list',
      method: 'GET',
      params
    })
  }

  // 新增小区
  addFCommunity(data) {
    return this.request({
      url: '/admin/v1/subdistrict',
      method: 'PUT',
      data
    })
  }

  // 编辑小区
  editFCommunity(id, data) {
    return this.request({
      url: `/admin/v1/subdistrict?id=${id}`,
      method: 'POST',
      data
    })
  }

  // 删除小区
  deleteFCommunity(id) {
    return this.request({
      url: `/admin/v1/subdistrict?id=${id}`,
      method: 'DELETE'
    })
  }

  // 管理员详情
  getAdminDetail(id) {
    return this.request({
      url: `/admin/v1/subdistrict/admin?id=${id}`,
      method: 'GET'
    })
  }

  addCommunity(data) {
    return this.request({
      url: `/api/admin/subdistrict/`,
      method: 'POST',
      data
    })
  }
  editCommunity(id, data) {
    return this.request({
      url: `/api/admin/subdistrict/${id}/`,
      method: 'PUT',
      data
    })
  }
  delCommunity(id) {
    return this.request({
      url: `/api/admin/subdistrict/${id}/`,
      method: 'DELETE'
    })
  }
  // #endregion

  // #region 住户管理（实名信息）
  getHouseholdList(params) {
    return this.request({
      url: '/api/admin/realname/',
      method: 'GET',
      params
    })
  }
  getHouseholdInfo(id) {
    return this.request({
      url: `/api/admin/realname/${id}/`,
      method: 'GET'
    })
  }
  addHousehold(data) {
    return this.request({
      url: `/api/admin/realname/`,
      method: 'POST',
      data
    })
  }
  editHousehold(id, data) {
    return this.request({
      url: `/api/admin/realname/${id}/`,
      method: 'PUT',
      data
    })
  }
  delHousehold(id) {
    return this.request({
      url: `/api/admin/realname/${id}/`,
      method: 'DELETE'
    })
  }
  setHouseholdStatus(id, data) {
    return this.request({
      url: `/api/admin/realname/${id}/`,
      method: 'PATCH',
      data
    })
  }

  getOperation(params) {
    return this.request({
      url: `/admin/v1/user/log`,
      method: 'GET',
      params
    })
  }

  // #region 实名审核
  getHouseholdAuditList(params) {
    return this.request({
      url: '/admin/v1/user/list',
      method: 'GET',
      params
    })
  }

  // 修改积分
  changeScore(id, data) {
    return this.request({
      url: `/admin/v1/user/balance?id=${id}`,
      method: 'POST',
      data
    })
  }

  getHouseholdAuditDetail(id) {
    return this.request({
      url: `/admin/v1/user?id=${id}`,
      method: 'GET'
    })
  }

  setHouseholdAuditStatus(id, status) {
    return this.request({
      url: `/admin/v1/user/check?id=${id}&status=${status}`,
      method: 'GET'
    })
  }

  deleteRealname(id) {
    return this.request({
      url: `/admin/v1/user?id=${id}`,
      method: 'DELETE'
    })
  }

  // #endregion

  getBannerList(typeId) {
    return this.request({
      url: `/admin/v1/banners/list?type_id=${typeId}`,
      method: 'GET'
    })
  }

  addBanner(data) {
    return this.request({
      url: `/admin/v1/banners`,
      method: 'PUT',
      data
    })
  }

  editBanner(id, data) {
    return this.request({
      url: `/admin/v1/banners?id=${id}`,
      method: 'POST',
      data
    })
  }

  deleteBanner(id) {
    return this.request({
      url: `/admin/v1/banners?id=${id}`,
      method: 'DELETE'
    })
  }
}
